#include <bits/stdc++.h>
using namespace std;

class Solution {
public:
    vector<vector<int>> threeSum(vector<int>& nums) {
        sort(nums.begin(), nums.end());
        int index = nums.size() - 1;
        int temp;
        int temp1 = INT_MAX;
        vector<vector<int>> result;

        for (int first = 0; first < nums.size(); first++) {
            if (temp1 == nums[first]) {
                continue;
            }
            index = nums.size() - 1;
            int temp2 = INT_MAX;

            for (int second = first + 1; second < nums.size(); second++) {
                if (temp2 == nums[second]) {
                    continue;
                }
                int k = nums[first] + nums[second];
                temp = -k;

                while (index > second && nums[index] > temp) {
                    index--;
                }

                if (index != second && nums[index] == temp) {
                    result.push_back({nums[first], nums[second], temp});
                    temp1 = nums[first];
                    temp2 = nums[second];
                }
            }
        }

        return result;
    }
};

int main() {
    int n;
    cin >> n;
    vector<int> nums(n);

    for (int i = 0; i < n; i++) {
        cin >> nums[i];
    }

    Solution s;
    vector<vector<int>> result = s.threeSum(nums);

    for (int i = 0; i < result.size(); i++) {
        cout << result[i][0] << " " << result[i][1] << " " << result[i][2] << endl;
    }

    return 0;
}